package com.chanricle.mixtoolset.activity;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.chanricle.mixtoolset.R;

public class ExpressSearchActivity extends Activity {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_express_search);

		/* Tab buttons */
		final Button quickBtn    = (Button) findViewById(R.id.btn_quick_search);
		final Button fuzzyBtn    = (Button) findViewById(R.id.btn_fuzzy_search);
		final Button historyBtn  = (Button) findViewById(R.id.btn_search_history);
		
		/* Clear history */
		final View deleteHistory = findViewById(R.id.ibtn_delete_history);
		
		OnClickListener tabButtonClickListener = new OnClickListener() {
			@Override
			public void onClick(View v) {
				quickBtn.setBackgroundResource(R.drawable.selector_tabs);
				fuzzyBtn.setBackgroundResource(R.drawable.selector_tabs);
				historyBtn.setBackgroundResource(R.drawable.selector_tabs);
				
				v.setBackgroundResource(R.drawable.bg_tabs_selected);
				
				// TODO Display content
				if(v.equals(historyBtn)) {
					deleteHistory.setVisibility(View.VISIBLE);
				} else {
					deleteHistory.setVisibility(View.INVISIBLE);
				}
				
			}
		};
		
		quickBtn.setOnClickListener(tabButtonClickListener);
		fuzzyBtn.setOnClickListener(tabButtonClickListener);
		historyBtn.setOnClickListener(tabButtonClickListener);
		
		/* Activity back event */
		View back = findViewById(R.id.ibtn_back);
		back.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				finish();
			}
		});
		
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}
}
